@echo off
echo 正在生成初始 spec 文件...
pyinstaller --onefile --windowed DeepSeekChatGUI.py

echo 正在修改 spec 文件以包含资源目录...
python -c "
spec_content = []
with open('DeepSeekChatGUI.spec', 'r', encoding='utf-8') as f:
    spec_content = f.readlines()

for i, line in enumerate(spec_content):
    if 'datas=[],' in line:
        spec_content[i] = '    datas=[(\\'reference_files\\', \\'reference_files\\'), (\\'conversations\\', \\'conversations\\'), (\\'config\\', \\'config\\'), (\\'api_logs\\', \\'api_logs\\')],\\n'
        break

with open('DeepSeekChatGUI.spec', 'w', encoding='utf-8') as f:
    f.writelines(spec_content)
"

echo 使用修改后的 spec 文件进行打包...
pyinstaller DeepSeekChatGUI.spec

echo 打包完成！
pause